package main

import (
	"fmt"
	"reflect"
	"sort"
	"strings"
)


func main() {
	s := make([]bool,0)
	sl := []int{89, 14, 8, 9, 17, 56, 95, 3}
	fmt.Println(sl) // [89 14 8 9 17 56 95 3]
	fmt.Printf("%p\n", &sl)
	sort.Ints(sl)
	fmt.Println(sl) // [3 8 9 14 17 56 89 95]
	fmt.Printf("%p\n", &sl)

	defer func() {
		r := recover()

		if r != nil{
			//runtime.boundsError.x
			fmt.Println(r)

			if reflect.TypeOf(r).String() == "runtime.boundsError"{
				fmt.Println(11111)
				fmt.Println(reflect.ValueOf(r))
				fmt.Printf("%T\n", r)
				if strings.Contains(fmt.Sprintf("%s", r), "out of range"){
					fmt.Println("out of range")

					var r1 interface{} = r
					r2,r3 := r1.(int)
					fmt.Println(r2)
					fmt.Println(r3)

					fmt.Println(reflect.TypeOf(r2))


				}else {
					fmt.Println(22)
					fmt.Println(reflect.ValueOf(r))
				}
			}



		}
	}()
	fmt.Println(s[0])

}